﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DotNetFrameworkExtendClass
{
    /// <summary>
    /// System.Datetime的扩展
    /// </summary>
    public static class DatetimeX
    {
        /// <summary>
        /// 获取此实例所表示的日期为该月中的第几周。
        /// </summary>
        /// <param name="utc"></param>
        /// <returns></returns>
        public static int WeekOfMonth(this DateTime utc)
        {
            return (utc.Day - (int)utc.DayOfWeek) / 7 + 1;
        }
    }
}
